<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>controlP5 : : ControlWindowCanvas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>ControlWindowCanvas</h1>
		<dl><dt class="key">description</dt><dd class="value">be warned, for now ControlWindowCanvas and ControlCanvas are EXPERIMENTAL and 
 will undergo changes in the future!
 
 use a controlWindowCanvas to draw your own content into a control window.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>import controlP5.*;

/**
  * WARNING
  * ControlCanvas and ControlWindowCanvas are yet EXPERIMENTAL
  * and therefore will undergo changes in the future before being
  * fully functional!
  */
  

ControlP5 controlP5;
ControlWindow controlWindow;
ControlWindowCanvas cc;

// your controlWindowCanvas class
class MyCanvas extends ControlWindowCanvas {
  public void draw(PApplet theApplet) {
    theApplet.fill(random(255));
    theApplet.rect(theApplet.mouseX,10,100,100);
  }
}


void setup() {
  size(400,400);
  frameRate(30);
  controlP5 = new ControlP5(this);
  
  // create a control window.
  controlWindow = controlP5.addControlWindow("controlP5window",100,100,400,400,30);
  
  // for continuous update use ControlWindow.NORMAL  to update a control
  // window only when it is in focus, use ControlWindow.ECONOMIC
  // economic is the default update value.
  controlWindow.setUpdateMode(ControlWindow.NORMAL);

  
  // create a control window canvas and add it to
  // the control window from above.  
  cc = new MyCanvas();
  cc.pre(); // use cc.post(); to draw on top of the controllers.
  controlWindow.addCanvas(cc);

}


void controlEvent(ControlEvent theEvent) {
  println(theEvent.controller().id()+"  /  "+
    theEvent.controller()+"  /  "+
    theEvent.controller().value()
    );
}


void draw() {
  background(0);
}
</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>ControlWindowCanvas();
</pre></dd></dl>
			
			
			
			
			
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="controlwindowcanvas_method_draw.htm">draw ( )</a></dt><dd class="value">controlWindowCanvas is an abstract class and therefore needs to be
 extended by your class. draw(PApplet theApplet) is the only method that
 needs to be overwritten.</dd></dl>
<dl><dt class="key"><a href="controlwindowcanvas_method_mode.htm">mode ( )</a></dt><dd class="value">get the drawing mode of a ControlWindowCanvas. this can be PRE or POST.</dd></dl>
<dl><dt class="key"><a href="controlwindowcanvas_method_moveto.htm">moveTo ( )</a></dt><dd class="value">move a canvas to another controlWindow</dd></dl>
<dl><dt class="key"><a href="controlwindowcanvas_method_post.htm">post ( )</a></dt><dd class="value">set the drawing mode to POST.</dd></dl>
<dl><dt class="key"><a href="controlwindowcanvas_method_pre.htm">pre ( )</a></dt><dd class="value">set the drawing mode to PRE. PRE is the default.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul></ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


